
<%@page import="entity.User"%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<!doctype html>
<html>
<head>
    <meta charset="UTF-8">
</head>
<body>

<%
    request.setCharacterEncoding("utf-8");
%>

<jsp:useBean id="user" class="entity.User" scope="page"/>

<jsp:setProperty name="user"  property="*"/>
<%--表单提交自动匹配，javabean的属性名和表单名必须一致--%>

<%--<jsp:setProperty name="user"  property="name"/>--%>
<%--javabeans property=" "表单只匹配规定的属性名--%>

<%--<jsp:setProperty name="user"  property="name" value="刘子健"/>--%>
<%--<jsp:setProperty name="user"  property="password" value="000000"/>--%>
<%--&lt;%&ndash;手动赋值&ndash;%&gt;--%>

<jsp:setProperty name="user"  property="phone" param="kc"/>
<%--取url参数赋值属性--%>

<h3>用户名：<%=user.getName()%></h3>
<h3>密码：<%=user.getPassword()%></h3>
<h3>电话：<%=user.getPhone()%></h3>

<%--使用动作标签获取属性--%>
<h3>用户名：<jsp:getProperty name="user" property="name"/></h3>
<h3>密码：<jsp:getProperty name="user" property="password"/></h3>
<h3>电话：<jsp:getProperty name="user" property="phone"/></h3>

</body>
</html>


